import request from '@/axios'
import { SampleGroupType, SampleStandardType } from './types'

// 抽样模型组
export const getSampleGroupListApi = (params: any) => {
  return request.get<SampleGroupType[]>({ url: '/check/sample/group', params })
}

export const addSampleGroupApi = (data: any) => {
  return request.post({ url: '/check/sample/group', data })
}

export const putSampleGroupApi = (data: any) => {
  return request.put({ url: `/check/sample/group/${data.id}`, data })
}

export const deleteSampleGroupApi = (ids: string[] | number[]) => {
  return request.delete({ url: '/check/sample/group', data: ids })
}

export const getSampleGroupOptionsApi = () => {
  return request.get({ url: '/check/sample/group/options' })
}

// 抽样规范
export const getSampleStandardListApi = (params: any) => {
  return request.get<SampleStandardType[]>({ url: '/check/sample/standard', params })
}

export const addSampleStandardApi = (data: any) => {
  return request.post({ url: '/check/sample/standard', data })
}

export const putSampleStandardApi = (data: any) => {
  return request.put({ url: `/check/sample/standard/${data.id}`, data })
}

export const deleteSampleStandardApi = (ids: string[] | number[]) => {
  return request.delete({ url: '/check/sample/standard', data: ids })
}
